package com.example.demo.dao.daolmpl;

import com.example.demo.dao.AccountInterface;
import com.example.demo.entity.Account;
import com.example.demo.entity.AccountMapper;
import com.example.demo.entity.UserMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Repository
public class AccountDao implements AccountInterface {

    @Resource
    AccountMapper accountMapper;

    //查询支出收入的条数
    @Override
    public String select1(int years, int months, int i, int mainIds) {
        return accountMapper.select1(years,months,i,mainIds);
    }

    @Override
    public String select2(int years, int months, int i, int mainIds) {
        return  accountMapper.select2(years,months,i,mainIds);
    }

    @Override
    public List<Map<String, Object>> select3(int years, int months, int i, int mainIds) {
        return accountMapper.select3(years,months,i,mainIds);
    }

    @Override
    public int OutAdd(Account account) {
        return accountMapper.OutAdd(account);
    }

    @Override
    public List<Map<String, Object>> select4(int years,int months, int i, int mainIds) {
        return accountMapper.select4(years,months,i,mainIds);
    }

    @Override
    public List<Map<String, Object>> selectDay(int years, int months, int days, int mainIds) {
        return accountMapper.selectDay(years,months,days,mainIds);
    }

    @Override
    public int Delete(int id) {
        return accountMapper.Delete(id);
    }

    @Override
    public List<Map<String, Object>> selectYear(int year, int kind, int mainId) {
        return accountMapper.selectYear(year,kind,mainId);
    }

    @Override
    public List<Map<String, Object>> selectAll(int years, int months, int mainIds) {
        return accountMapper.selectAll(years,months,mainIds);
    }

    @Override
    public float SelectMaxDay(int years, int months,int i, int mainIds) {
        if(accountMapper.SelectMaxDay(years,months,i,mainIds)>0){
            return accountMapper.SelectMaxDay(years,months,i,mainIds);
        }
        return 0;
    }

    @Override
    public float SelectAverageDay(int years, int months,int i, int mainIds) {
        if(accountMapper.SelectAverageDay(years,months,i,mainIds)>0){
            return accountMapper.SelectAverageDay(years,months,i,mainIds);
        }
        return 0;
    }

    @Override
    public int UpdateMoney(int ids, float moneys) {
        return accountMapper.UpdateMoney(ids,moneys);
    }

}
